<extend name="Public:innerbase" />
<block name="js">
<script type="text/javascript" src="{:RES}/js/spark.util.js"></script>
<include file="Public:upload" />
<script>
function selectall(name) {
	var checkItems=$('.cbitem');
	if ($("#check_box").attr('checked')==false) {
		$.each(checkItems, function(i,val){
			val.checked=false;
		});
	}else {
		$.each(checkItems, function(i,val){
			val.checked=true;
		});
	}
}
</script>
<script type="text/javascript">
function showIntroDetail(url){
	art.dialog.open(url,{lock:false,title:'订单详情',width:700,height:420,yesText:'关闭',background: '#000',opacity: 0.87});
}
</script>
</block>
<block name="content">
<div class="container-fluid">
	<div class="page-header wm-page-header">
		<h4>订单管理</h4>
		<div class="alert alert-info">
			<a href="{:U('Product/orders',array('handled'=>0))}">未处理订单<span style="color:#f00">{$unhandledCount}</span>个</a>
		</div>
	</div>
	<button style="margin-bottom:10px;" onclick="$('#info').submit()" title="" class="btn btn-primary">处理订单</button>
	<table class="table wm-table-bordered">
		<form id="info" method="post">
		<thead>
		<tr>
		<th width="60"><input type="checkbox" value="" id="check_box" onclick="selectall('id[]');"></th>
		<th width="70">姓名</th>
		<th width="80">电话</th>
		<th class="60">数量</th>
		<th width="100">总价（元）</th>
		<th class="160">付款状态/发货状态</th>
		<th class="60">状态</th>
		<th width="160">创建时间</th>
		<th width="150" class="norightborder">操作</th>
		</tr>
		</thead>
		<tbody>
		<volist name="orders" id="o"> 
		<tr>
		<td><input type="checkbox" value="{$o.id}" class="cbitem" name="id_{$i}"></td>
		<td>{$o.truename}</td>
		<td>{$o.tel}</td>
		<td>{$o.total}</td>
		<td>{$o.price}</td>
		<td><if condition="$o.paid eq 1"><span style="color:green">已付款</span><else/><span style="color:red">未付款</span></if> / <if condition="$o.sent eq 1"><span style="color:green">已发货</span><else/><span style="color:red">未发货</span></if></td>
		<td><if condition="$o.handled eq 1"><span style="color:green">已处理</span><else/><span style="color:red">未处理</span></if></td>
		<td>{$o.time|date="Y-m-d H:i:s",###}</td> 
		<td>
		<a href="###" onclick="showIntroDetail('{:U('Product/orderInfo',array('id'=>$o['id']))}')">详细</a>
		
		<a href="javascript:spark.confirm_jump('您确定要删除吗?', '{:U('Product/deleteOrder',array('id'=>$o['id']))}');">删除</a>
		</td>
		</tr>
		</volist>
		</tbody>
		</form>
	</table>
	<div class="pages">{$page}</div>
</div>
</block>